<?php
/**
 * Created by PhpStorm.
 * User: wangye
 * Date: 19-3-5
 * Time: 上午9:55
 */
$str = 'ABCDEFGHIJKMLN';
function str_rev($str) {
    for ($i=0;true;$i++) {
        if (isset($str[$i])) {
            break;
        }
    }
    $return = '';
    for ($j=$i-1;$j>=0;$j--) {
        $return .= $str[$j];
    }
    return $return;
}

echo str_rev($str);